﻿using System;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
using WebSite.ClientBin.Config;

namespace WebSite.Admin
{
    public partial class Default : System.Web.UI.Page
    {
        Settings setting;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack == false)
            {
                string path = Server.MapPath("/clientbin/config/settings.xml");
                XDocument doc = XDocument.Load(path, LoadOptions.None);
                XmlSerializer seri = new XmlSerializer(typeof(Settings));

                XmlReader reader = doc.CreateReader();
                if (seri.CanDeserialize(reader))
                {
                    setting = seri.Deserialize(reader) as Settings;
                }
                else
                {
                    setting = null;
                }
            }
        }
    }
}